#pragma once
#include <string>
#include <vector>
#include "SDLComponent.h"
#include "SDLResources.h"
#include "SDLTexte.h"
#include "SDLInput.h"

class ScreenMenu :
	public SDLSprite
{
public:
	ScreenMenu();
	~ScreenMenu();

	//ScreenMenu(int positionX, int positionY, int screenWidth, int screenHeight, int numberMatrixCaseX, int numberMatrixCaseY);
	ScreenMenu(int positionX, int positionY, int screenWidth, int screenHeight, int numberMatrixCaseX, int numberMatrixCaseY, SDL_Color* TextColor = nullptr, int fontSizeMenu = 30, std::string fileFont = "Assets\\Fonts\\old_school_ff.ttf");

	//ScreenMenu(int positionX, int positionY, int screenWidth, int screenHeight, int numberMatrixCaseX, int numberMatrixCaseY, int fontSizeMenu);

	void AddMenu(std::string menuText, bool canSelectTexte, bool canGlow);
	SDLTexte* AddVariableMessageMenu(std::string* menuText, bool canSelectTexte, bool canGlow);
	SDLTexte* AddVariableMenu(int* linkVariable, bool canSelectTexte, bool canGlow);
	SDLTexte* AddVariableAndTexteMenu(std::string beginText, int* linkVariable, std::string endText, bool canSelectTexte, bool canGlow);
	//void DeleteMenu(std::string menuTextDelede);

	void AddMenuPosition();

	void ShowGlowTexteMenu(int indexMenu, bool isGlow);

	void UpdateMenuWindows();

	void SetVisible(bool visible);//{ this->visible = visible; }
	bool GetVisible(){ return visible; }

	void SetActivated(bool activate){ isActivated = activate; }

	void BlitToBackGroundTexture(int width, int height);

	//void LinkVariableMenuSelect(int* variableForSelection);
	int GetMenuSelection();

	void Start(){}
	void Stop(){}
	void Update();
	void Draw();

	 //void SetPosition(int x, int y){};
	 //bool IsValid(){return 0;};

private:
	void ApplySurfaceMenu(int x, int y, SDL_Texture* texture, SDL_Renderer* renderer);
	

	static const int BORD_WIDTH = 2;
	static const int BORD_HEIGHT = 6;
	static const int COIN_SIZE = 12;

	SDL_Rect MenuBackGround;
	SDL_Rect rect;
	SDL_Rect rectBackground;

	int screenWidth;
	int screenHeight;
	int caseWidth;
	int caseHeight;

	SDL_Rect mesure;

	bool menucanselected;
	int selectTexteEnCour;

	int numberMatrixCaseX;
	int numberMatrixCaseY;
	int numberMenu;

	int fontSize;
	std::string fileFont;
	SDL_Color couleur;
	SDL_Color glowColor;

	int oldPositionX;
	int oldPositionY;
	//bool visible;

	int returnSelection;

	bool isActivated;

	SDL_Texture* backGroundTexture;
	SDLSprite* curseur;

	SDL_Texture* coinHautGauche;
	SDL_Texture* coinHautDroit;
	SDL_Texture* coinBasGauche;
	SDL_Texture* coinBasDroit;

	SDL_Texture* bordHaut;
	SDL_Texture* bordDroit;
	SDL_Texture* bordGauche;
	SDL_Texture* bordBas;

	std::vector<SDLTexte*> listeTexte;
	std::vector<SDLTexte*> listeGlowTexte;
};

